<h3 class="login-title">注册用户</h3>

<?php
	echo form_open('user/create_member');
?>

<div class="reg-item clearfix">
	<div class="reg-input-wrapper">
		<label class="login-label" for="username">用户名</label>
		<?php
			$ndata = array('name' => 'user_name', 'id' => 'username','class' =>'login-input', 'size' => '25','tabindex'=>'1');
			echo form_input($ndata);
		?>
	</div>
	<div class="reg-tip" for="username">
		<span>输入用户名做登录帐号</span>
	</div>
</div>

<div class="reg-item clearfix">
	<div class="reg-input-wrapper">
		<label class="login-label" for="password">密码</label>
		<?php
			$pdata = array('name' => 'password', 'id' => 'password','type'=>'password','class' =>'login-input', 'size' => '25','tabindex'=>'2');
			echo form_input($pdata);
		?>
	</div>
	<div class="reg-tip" for="password">
		输入密码
	</div>
</div>

<div class="reg-item clearfix">
	<div class="reg-input-wrapper">
		<label class="login-label" for="password_confirm">确认密码</label>
		<?php
			$pcdata = array('name' => 'password_confirm', 'id' => 'password_confirm','type'=>'password','class' =>'login-input', 'size' => '25','tabindex'=>'3');
			echo form_input($pcdata);
		?>
	</div>
	<div class="reg-tip" for="password_confirm">
		确认上面输入的密码
	</div>
</div>

<div class="reg-item clearfix">
	<div class="reg-input-wrapper">
		<label class="login-label" for="email">邮箱</label>
		<?php
			$edata = array('name' => 'email', 'id' => 'email','type'=>'text','class' =>'login-input', 'size' => '50','tabindex'=>'4');
			echo form_input($edata);
		?>
	</div>
	<div class="reg-tip" for="email">
		输入个人常用的邮箱
	</div>
</div>


<div class="reg-radio clearfix">
	<div class="reg-input-wrapper">
		<label>
		<?php
			$mandata = array('name'=>'sex','id'=>'man','value'=>'man','checked'=>TRUE,'tabindex'=>'5');
			echo form_radio($mandata);
			echo form_label('男','label4');
		?>
		</label>
		<label>
			<?php
			$womandata = array('name'=>'sex','id'=>'woman','value'=>'woman','checked'=>FALSE,'tabindex'=>'6');
			echo form_radio($womandata);
			echo form_label('女','label5');
			?>
		</label>
	</div>
	<div class="reg-tip" for="gender">
		请问您想选其他吗？
	</div>
</div>

<div class="reg-radio clearfix">
	<div class="reg-input-wrapper">
		<label id="curCity_1">所在城市：北京</label>
		<input type="hidden" name="curCity" id="curCity" value="北京"/>
		<input type="hidden" name="citytype" id="citytype" value="2"/>
		<input type="hidden" name="point_x" id="point_x" value="116.395645"/>
		<input type="hidden" name="point_y" id="point_y" value="39.929986"/>
		[<a id="curCityText" href="javascript:void(0)">更换城市</a>]
	</div>
	<div class="reg-tip" for="city">
		请选择您所在的城市
	</div>
</div>



<div class="last-option clearfix">
	<?php 
		$sdata = array('name'=>'submit','value'=>'Create','class'=>'reg-submit','tabindex'=>'4');
		
		echo form_submit($sdata);
	?>
	<span class="reg-link">
		<?php
			echo '已有帐号？赶紧';
			echo anchor('user/index', '登录');
			echo '吧';
		?>
	</span>
</div>

<?php echo form_close()?>

<div class="map_popup" id="cityList" style="display:none;">

    <div class="popup_main">

        <div class="title">城市列表</div>

		<div class="cityList" id="citylist_container"></div>
        <button id="popup_close"></button>
    </div>

</div>

<?php echo validation_errors('<p class="error">'); ?>

<script type="text/javascript">
$(function(){
		if($("#username").val()!="")
			$(".login-label[for='username']").hide();
		if($("#password").val()!="")
			$(".login-label[for='password']").hide();
		if($("#password_confirm").val()!="")
			$(".login-label[for='password_confirm']").hide();
		if($("#email").val()!="")
			$(".login-label[for='email']").hide();
	});
	
	$("#username").focusin(function(){
		$(".login-label[for='username']").css("color","#CCC");
		$("#username").css("border","1px solid #FFC34C");
		$(".reg-tip[for='username']").show();
		if($("#username").val()!="")
			$(".login-label[for='username']").hide();
	});
	
	$("#username").keypress(function(){
		$(".login-label[for='username']").hide();
	});
	
	$("#username").blur(function(){
		if(this.value==""){
			$(".login-label[for='username']").show();
			$(".login-label[for='username']").css("color","#92A2AF");	
		}
		else
			$(".login-label[for='username']").hide();
		$(".reg-tip[for='username']").hide();
		$("#username").css("border","1px solid #FFF");
	});
	
	$("#password").focus(function(){
		$(".login-label[for='password']").css("color","#CCC");		
		$(".reg-tip[for='password']").show();
		$("#password").css("border","1px solid #FFC34C");
		if($("#password").val()!="")
			$(".login-label[for='password']").hide();
	});
	
	$("#password").keypress(function(){
		$(".login-label[for='password']").hide();
	});
	
	$("#password").blur(function(){
		if(this.value==""){
			$(".login-label[for='password']").show();
			$(".login-label[for='password']").css("color","#92A2AF");	
		}
		else
			$(".login-label[for='password']").hide();
		$(".reg-tip[for='password']").hide();
		$("#password").css("border","1px solid #FFF");
	});	
	
	$("#password_confirm").focus(function(){
		$(".login-label[for='password_confirm']").css("color","#CCC");		
		$(".reg-tip[for='password_confirm']").show();
		$("#password_confirm").css("border","1px solid #FFC34C");
		if($("#password_confirm").val()!="")
			$(".login-label[for='password_confirm']").hide();
	});
	
	$("#password_confirm").keypress(function(){
		$(".login-label[for='password_confirm']").hide();
	});
	
	$("#password_confirm").blur(function(){
		if(this.value==""){
			$(".login-label[for='password_confirm']").show();
			$(".login-label[for='password_confirm']").css("color","#92A2AF");	
		}
		else
			$(".login-label[for='password_confirm']").hide();
		$(".reg-tip[for='password_confirm']").hide();
		$("#password_confirm").css("border","1px solid #FFF");
	});	
	
	$("#email").focus(function(){
		$(".login-label[for='email']").css("color","#CCC");		
		$(".reg-tip[for='email']").show();
		$("#email").css("border","1px solid #FFC34C");
		if($("#email").val()!="")
			$(".login-label[for='email']").hide();
	});
	
	$("#email").keypress(function(){
		$(".login-label[for='email']").hide();
	});
	
	$("#email").blur(function(){
		if(this.value==""){
			$(".login-label[for='email']").show();
			$(".login-label[for='email']").css("color","#92A2AF");	
		}
		else
			$(".login-label[for='email']").hide();
		
		var pattern=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]w+)*$/;
 		var email = this.value;

 		if(email!="" && !pattern.test(email)){
  		$(".reg-tip[for='email']").html("邮箱格式不正确");
  		//$().css("background-position","0 -117px");
  	}
  	else{
  		$(".reg-tip[for='email']").html("输入个人常用邮箱");
			$(".reg-tip[for='email']").hide();
  	}
		$("#email").css("border","1px solid #FFF");
	});	
	
</script>

<script type="text/javascript" >
// 新创建地图
var map = new BMap.Map("ditu");

map.centerAndZoom(new BMap.Point(116.395645, 39.929986), 12);

// 创建CityList对象，并放在citylist_container节点内

var myCl = new BMapLib.CityList({container : "citylist_container", map : map});

// 给城市点击时，添加相关操作
myCl.addEventListener("cityclick", function(e) {
	// 修改当前城市显示
	document.getElementById("curCity").value = e.name;
	document.getElementById("curCity_1").innerHTML = e.name;
	$("#citytype").val(e.citytype);
	$("#point_x").val(e.center.lng);
	$("#point_y").val(e.center.lat);

	// 点击后隐藏城市列表
	$("#cityList").hide();
	$(".reg-tip[for='city']").hide();
});

// 给“更换城市”链接添加点击操作
document.getElementById("curCityText").onclick = function() {
	var cl = document.getElementById("cityList");
	if (cl.style.display == "none") {
		cl.style.display = "";
		$(".reg-tip[for='city']").show();
	} else {
		cl.style.display = "none";
		$(".reg-tip[for='city']").hide();
	}	
};

// 给城市列表上的关闭按钮添加点击操作
document.getElementById("popup_close").onclick = function() {
	var cl = document.getElementById("cityList");
	if (cl.style.display == "none") {
		cl.style.display = "";
	} else {
		cl.style.display = "none";
	}
	$(".reg-tip[for='city']").hide();
};
</script>